package top.byteio.common.core.constants;


import java.util.regex.Pattern;

/**
 * token 常量
 *
 * @author lerry
 * @since 2023/6/21 13:27
 */

public final class TokenConstants {
    /**
     * 用户ID
     */
    public static final String JWT_USERID = "userid";

    /**
     * 用户名称
     */
    public static final String JWT_USERNAME = "username";

    /**
     * 令牌
     */
    public static final String TOKEN = "token";

    /**
    *令牌匹配格式
    */
    public static final Pattern AUTHORIZATION_PATTERN = Pattern.compile("^Bearer (?<token>[a-zA-Z0-9-:._~+/]+=*)$", Pattern.CASE_INSENSITIVE);

    /**
     * token 头
     */
    public static final String TOKEN_HEADER = "Authorization";

    /**
     * 令牌前缀
     */
    public static final String TOKEN_PREFIX = "Bearer ";


    /**
     * 授权码
     */
    public static final String AUTHORIZATION_CODE = "authorization_code";

    /**
     *  访问令牌
     */
    public static final String ACCESS_TOKEN = "access_token";

    /**
     * 刷新令牌
     */
    public static final String REFRESH_TOKEN = "refresh_token";

    /**
     * 客户端凭据
     */
    public static final String CLIENT_CREDENTIALS = "client_credentials";

    /**
     * 创建时间
     */
    public static final String JWT_CREATED = "created";

    /**
     * 用户角色
     */
    public static final String JWT_ROLES = "roles";

    /**
     * 用户权限
     */
    public static final String JWT_AUTHORITIES = "authorities";


    /**
     * 授权范围
     */
    public static final  String  SCOPES = "scope";
}
